package com.ruoyi.system.service.impl;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.entity.PreventionMyCheckTask;
import com.ruoyi.system.mapper.PreventionMyCheckTaskMapper;
import com.ruoyi.system.service.PreventionMyCheckTaskService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 我的排查任务 服务实现类
 * </p>
 * @since 2023-03-13
 */
@Service("preventionMyCheckTaskService")
public class PreventionMyCheckTaskServiceImpl implements PreventionMyCheckTaskService {

    @Resource
    private PreventionMyCheckTaskMapper preventionMyCheckTaskMapper;

    @Override
    public List<PreventionMyCheckTask> queryByPage(PreventionMyCheckTask preventionMyCheckTask) {
        return preventionMyCheckTaskMapper.queryAllByLimit(preventionMyCheckTask);
    }

    @Override
    public PreventionMyCheckTask queryById(Integer id) {
        return this.preventionMyCheckTaskMapper.queryById(id);
    }

    @Override
    public PreventionMyCheckTask insert(PreventionMyCheckTask preventionMyCheckTask) {
        preventionMyCheckTask.setCreateUser(SecurityUtils.getUsername());
        this.preventionMyCheckTaskMapper.insert(preventionMyCheckTask);
        return preventionMyCheckTask;
    }

    @Override
    public PreventionMyCheckTask update(PreventionMyCheckTask preventionMyCheckTask) {
        this.preventionMyCheckTaskMapper.update(preventionMyCheckTask);
        return this.queryById(preventionMyCheckTask.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return this.preventionMyCheckTaskMapper.deleteById(id) > 0;
    }
}
